<script setup>
// defineEmits(['someEvent','someOtherEvent'])
defineEmits({
    // key:value
    someEvent: null, // 定义一个自定义事件，名称为someEvent，不校验事件参数
    someOtherEvent:(arg)=>{
        if(arg.username && arg.password){
            return true; // 返回true，表示事件处理成功
        }else{
            return false; // 返回false，表示事件处理失败
        }
      
        
    }
})
</script>

<template>
<div>
    <button @click="$emit('someEvent',1,2)">btn</button>
    <button @click="$emit('someOtherEvent',{username:'zhangsan',password:'123456'})">someOhterEvent</button>
    <button @click="$emit('someOtherEvent',{username:'',password:'123456'})">someOhterEvent2</button>
</div>
</template>

<style scoped>
</style>